using System;
using System.Collections.Generic;
using System.Text;
using Barrage;
using SlimDX;
using Barrage.Meshes.Text;
using Spacedash.Logic;
using Barrage.Language;

namespace Spacedash.Game.Items
{
    class GUILapCounter:Item
    {
        const string LAPS = "LAPS";
        public const float SIZE_X = 175;
        public const float SIZE_Y = 50;
        TextBoxMesh textBoxMesh;
        Ship ship;
        Race race;
        public GUILapCounter(Vector2 position, Race race, Ship ship)
        {
            this.ship = ship;
            this.race = race;
            motion.Translation = new Vector3(position,0);
            TextBoxDrawProperties tbdp=new TextBoxDrawProperties(TextAlignment.Center,new Vector2(SIZE_X,SIZE_Y),0.33f,VerticalAlignment.Top,Vector2.Zero);
            textBoxMesh = new TextBoxMesh(BitmapFontManager.Fonts["Standard"],tbdp);
            textBoxMesh.FirstMaterial.Diffuse = (Color4)ship.Color;
            addMesh(textBoxMesh);
        }

        protected override void DoUpdate()
        {
            textBoxMesh.Text = LanguageManager.Texts[LAPS] + "\n" + ship.CurrentLapNumber.ToString() + " / " + race.LapNumber;
            base.DoUpdate();
        }
    }
}
